package com.hx.vending.dao;

import com.hx.vending.bean.MenuRole;
import com.hx.vending.bean.Role;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by Administrator on 2019/1/3.
 */
@Repository
public interface RoleMapper {
    /**
     * 查询菜单列表
     * @param role
     * @return
     */
    List<Role> selectRoles(Role role);

    /**
     * 添加菜单
     * @param role
     * @return
     */
    int insertRole(Role role);

    /**
     * 修改角色
     * @param role
     * @return
     */
    int updateByPrimaryKey(Role role);

    /**
     * 删除某个角色的所有权限
     * @param roleId
     * @return
     */
    int deleteRoleMenuById(@Param("roleId") Integer roleId);

    /**
     * 添加权限
     * @param menuRole
     * @return
     */
    int inserMenuRole(MenuRole menuRole);

    /**
     * 删除角色
     * @param roleId
     * @return
     */
    int deleteRoleById(@Param("roleId") Integer roleId);

    Role selectByPrimary(Role role);

    String[] selectMenuByRole(@Param("roleId") Integer roleId);
}
